package cn.yeziji.forum.entity;

import cn.org.atool.fluent.mybatis.annotation.FluentMybatis;
import cn.org.atool.fluent.mybatis.annotation.TableField;
import cn.org.atool.fluent.mybatis.annotation.TableId;
import cn.org.atool.fluent.mybatis.base.RichEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.util.Date;

/**
 * ForumCommentEntity: 数据映射实体定义
 *
 * @author Powered By Fluent Mybatis
 */
@SuppressWarnings({"rawtypes", "unchecked"})
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@FluentMybatis(table = "forum_comment", schema = "yzj_forum")
public class ForumCommentEntity extends RichEntity {
  private static final long serialVersionUID = 1L;

  /** */
  @TableId("id")
  private Integer id;

  /** 评论内容 */
  @TableField("content")
  private String content;

  /** */
  @TableField("createTime")
  private Date createTime;

  /** */
  @TableField("delete")
  private Boolean delete;

  /** 文章id */
  @TableField("detailId")
  private Integer detailId;

  /** 点赞数量 */
  @TableField("goodNumber")
  private Integer goodNumber;

  /** 上级评论id */
  @TableField("parentCommentId")
  private Integer parentCommentId;

  /** 回复数量 */
  @TableField("replyNumber")
  private Integer replyNumber;

  /** */
  @TableField("updateTime")
  private Date updateTime;

  /** 用户id */
  @TableField("userId")
  private Integer userId;

  /** 用户昵称 */
  @TableField("nickname")
  private String nickname;

  /** 用户头像 */
  @TableField("avatar")
  private String avatar;

  @Override
  public final Class entityClass() {
    return ForumCommentEntity.class;
  }

  public static Integer parentIdIsZero(Integer id) {
    return id == 0 ? null : id;
  }
}
